namespace CSharpPro._1023;

public class Student
{
    private String id;
    private String name;
    private char gender;
    DateTime birth;
    private String clazz;
    //其他特性
    private object others;

    public Student()
    {
    }

    public Student(string id, string name, char gender, DateTime birth, string clazz, object others)
    {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.birth = birth;
        this.clazz = clazz;
        this.others = others;
    }

    public string Id
    {
        get => id;
        set => id = value ?? throw new ArgumentNullException(nameof(value));
    }

    public string Name
    {
        get => name;
        set => name = value ?? throw new ArgumentNullException(nameof(value));
    }

    public char Gender
    {
        get => gender;
        set => gender = value;
    }

    public DateTime Birth
    {
        get => birth;
        set => birth = value;
    }

    public string Clazz
    {
        get => clazz;
        set => clazz = value ?? throw new ArgumentNullException(nameof(value));
    }

    public String toString()
    {
        return "id:"+id+",name:"+name+",gender:"+gender+",birth:"+birth+",clazz:"+clazz;
    }

    //结构函数
    public void Deconstruct(out string id, out string name, out char gender, out DateTime birth, out string clazz)
    {
        id = this.id;
        name = this.name;
        gender = this.gender;
        birth = this.birth;
        clazz = this.clazz;
    }
    //析构函数
    ~Student()
    {
        Console.WriteLine("Student 对象已销毁。");
    }
}